﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Configuration;
using System.Data.Sql;
using System.Data;

namespace cancerportal.Data
{
    public class DataBaseConnection
    {
        public static SqlConnection DBConnect;
        public static SqlCommand DBCommand; 
        public static SqlDataReader reader;
        public static string connectionString = ConfigurationManager.ConnectionStrings["StringConnection"].ToString();
        public DataBaseConnection()
        {
            
        }
        public SqlConnection getConnection()
        {
            return DBConnect;
        }
        public static void open()
        {
            if (DBConnect == null || DBConnect.State == ConnectionState.Closed)
            {
                DBConnect = new SqlConnection(connectionString);
                DBConnect.Open();
                DBCommand = new SqlCommand("", DBConnect);
            }
            else
            {
            }
        }
        public static void close()
        {
            if (DBConnect.State == ConnectionState.Open)
            {
                DBConnect.Close();
            }
        }
    }
}